public class TestDemo03 {
    public static void main(String[] args) {
        //1、创建老王对象
        People laoWang = new People("老王");
        //2、创建一个枪
        Gun gun = new Gun("ak47");

        //3、让人类持有枪
        laoWang.gun = gun;

        //4、创建一个弹夹
        Clip clip = new Clip(30);

        // 5、创建30发子弹
        for (int i = 0; i < 30; i++) {
            Cartridge cartridge = new Cartridge("7.62", 11);
            // 6、把子弹压入到弹夹中
            boolean result = clip.pushCartridge(cartridge);
//            System.out.println(result ? "成功" : "失败");
        }
        // 7、把弹夹安装到枪
        gun.clip = clip;

        // 8、创建一个敌人
        People laoBa = new People("老九");

        //9.开枪
        for (int i = 0; i < 31; i++) {
            laoWang.biuBiu(laoBa);
        }


    }
}
